package com.plian.system.wrapper.fr.bulletin;

import com.plian.system.dto.fr.bulletin.NewBulletinDTO;
import com.plian.system.entity.fr.bulletin.NewBulletin;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.bulletin.BulletinTransferVO;
import com.plian.system.vo.fr.bulletin.NewBulletinVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 快报主表,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-09-26
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface NewBulletinWrapper extends BaseWrapper<NewBulletin, NewBulletinDTO, NewBulletinVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "orgId", target = "orgName", qualifiedByName = ORG_ID_TO_NAME),
			@Mapping(source = "tableTypeCode", target = "hasChild", qualifiedByName = BULLETIN_CHECK_HAS_CHILD)
	})
	NewBulletinVO entityToVO(NewBulletin entity);

	/**
	 * transferVO to entity
	 * @param transferVO
	 * @return
	 */
	NewBulletin transferToEntity(BulletinTransferVO transferVO);

}
